home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / man / cat.1 / libppm.1 < prev    next >
Text File  |  1995-07-25  |  7KB  |  199 lines

  1.  
  2.  
  3.  
  4.      lllliiiibbbbppppppppmmmm((((3333))))                XXXXEEEENNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV                 lllliiiibbbbppppppppmmmm((((3333))))
  5.  
  6.  
  7.  
  8.      NNNNAAAAMMMMEEEE
  9.           libppm - functions to support portable pixmap programs
  10.  
  11.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.           #include <ppm.h>
  13.           cc ... libppm.a libpgm.a libpbm.a
  14.  
  15.  
  16.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  17.         TTTTYYYYPPPPEEEESSSS AAAANNNNDDDD CCCCOOOONNNNSSSSTTTTAAAANNNNTTTTSSSS
  18.           typedef ... pixel;
  19.           typedef ... pixval;
  20.           #define PPM_MAXMAXVAL ...
  21.           extern pixval ppm_pbmmaxval;
  22.  
  23.           Each ppppiiiixxxxeeeellll contains three ppppiiiixxxxvvvvaaaalllls, each of which should
  24.           contain only the values between 0000 and PPPPPPPPMMMM____MMMMAAAAXXXXMMMMAAAAXXXXVVVVAAAALLLL.
  25.           ppppppppmmmm____ppppbbbbmmmmmmmmaaaaxxxxvvvvaaaallll is the maxval used when a PPM program reads a
  26.           PBM file.  Normally it is 1; however, for some programs, a
  27.           larger value gives better results.
  28.  
  29.           #define PPM_FORMAT ...
  30.           #define RPPM_FORMAT ...
  31.           #define PPM_TYPE PPM_FORMAT
  32.           int PPM_FORMAT_TYPE( int format )
  33.  
  34.           For distinguishing different file formats and types.
  35.  
  36.           pixval PPM_GETR( pixel p )
  37.           pixval PPM_GETG( pixel p )
  38.           pixval PPM_GETB( pixel p )
  39.  
  40.           These three macros retrieve the red, green or blue value
  41.           from the given pixel.
  42.  
  43.           void PPM_ASSIGN( pixel p, pixval red, pixval grn, pixval blu )
  44.  
  45.           This macro assigns the given red, green and blue values to
  46.           the pixel.
  47.  
  48.           int PPM_EQUAL( pixel p, pixel q )
  49.  
  50.           This macro checks two pixels for equality.
  51.  
  52.           void PPM_DEPTH( pixel newp, pixel p, pixval oldmaxval, pixval newmaxval )
  53.  
  54.           This macro scales the colors of pixel pppp according the old
  55.           and new maximum values and assigns the new values to nnnneeeewwwwpppp.
  56.           It is intended to make writing ppmtowhatever easier.
  57.  
  58.           float PPM_LUMIN( pixel p )
  59.  
  60.  
  61.  
  62.  
  63.      Page 1                                           (printed 9/7/93)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      lllliiiibbbbppppppppmmmm((((3333))))                XXXXEEEENNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV                 lllliiiibbbbppppppppmmmm((((3333))))
  71.  
  72.  
  73.  
  74.           This macro determines the luminance of the pixel pppp.
  75.  
  76.         MMMMEEEEMMMMOOOORRRRYYYY MMMMAAAANNNNAAAAGGGGEEEEMMMMEEEENNNNTTTT
  77.           pixel** ppm_allocarray( int cols, int rows )
  78.  
  79.           Allocate an array of pixels.
  80.  
  81.           pixel* ppm_allocrow( int cols )
  82.  
  83.           Allocate a row of the given number of pixels.
  84.  
  85.           void ppm_freearray( pixel** pixels, int rows )
  86.  
  87.           Free the array allocated with ppppppppmmmm____aaaallllllllooooccccaaaarrrrrrrraaaayyyy(((()))) containing
  88.           the given number of rows.
  89.  
  90.           void pbm_freerow( pixel* pixelrow )
  91.  
  92.           Free a row of pixels.
  93.  
  94.         RRRREEEEAAAADDDDIIIINNNNGGGG PPPPBBBBMMMM FFFFIIIILLLLEEEESSSS
  95.           void ppm_readppminit( FILE* fp, int* colsP, int* rowsP, pixval* maxvalP, int* formatP )
  96.  
  97.           Read the header from a PPM file, filling in the rows, cols,
  98.           maxval and format variables.
  99.  
  100.           void ppm_readppmrow( FILE* fp, pixel* pixelrow, int cols, pixval maxval, int format )
  101.  
  102.           Read a row of pixels into the pixelrow array.  Format, cols,
  103.           and maxval were filled in by ppppppppmmmm____rrrreeeeaaaaddddppppppppmmmmiiiinnnniiiitttt(((()))).
  104.  
  105.           pixel** ppm_readppm( FILE* fp, int* colsP, int* rowsP, pixval* maxvalP )
  106.  
  107.           Read an entire pixmap file into memory, returning the
  108.           allocated array and filling in the rows, cols and maxval
  109.           variables.  This function combines ppppppppmmmm____rrrreeeeaaaaddddppppppppmmmmiiiinnnniiiitttt(((()))),
  110.           ppppppppmmmm____aaaallllllllooooccccaaaarrrrrrrraaaayyyy(((()))) and ppppppppmmmm____rrrreeeeaaaaddddppppppppmmmmrrrroooowwww(((()))).
  111.  
  112.         WWWWRRRRIIIITTTTIIIINNNNGGGG FFFFIIIILLLLEEEESSSS
  113.           void ppm_writeppminit( FILE* fp, int cols, int rows, pixval maxval, int forceplain )
  114.  
  115.           Write the header for a portable pixmap file.  The forceplain
  116.           flag forces a plain-format file to be written, as opposed to
  117.           a raw-format one.
  118.  
  119.           void ppm_writeppmrow( FILE* fp, pixel* pixelrow, int cols, pixval maxval, int forceplain )
  120.  
  121.           Write a row from a portable pixmap.
  122.  
  123.           void ppm_writeppm( FILE* fp, pixel** pixels, int cols, int rows, pixval maxval, int forceplain )
  124.  
  125.           Write the header and all data for a portable pixmap.  This
  126.  
  127.  
  128.  
  129.      Page 2                                           (printed 9/7/93)
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.      lllliiiibbbbppppppppmmmm((((3333))))                XXXXEEEENNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV                 lllliiiibbbbppppppppmmmm((((3333))))
  137.  
  138.  
  139.  
  140.           function combines ppppppppmmmm____wwwwrrrriiiitttteeeeppppppppmmmmiiiinnnniiiitttt(((()))) and ppppppppmmmm____wwwwrrrriiiitttteeeeppppppppmmmmrrrroooowwww(((()))).
  141.  
  142.         CCCCOOOOLLLLOOOORRRR NNNNAAAAMMMMEEEESSSS
  143.           pixel ppm_parsecolor( char* colorname, pixval maxval )
  144.  
  145.           Parses an ASCII color name into a pixel.  The color can be
  146.           specified in three ways.  One, as a name, assuming that a
  147.           pointer to an X11-style color names file was compiled in.
  148.           Two, as an X11-style hexadecimal number: #rgb, #rrggbb,
  149.           #rrrgggbbb, or #rrrrggggbbbb.  Three, as a triplet of
  150.           decimal floating point numbers separated by commas:
  151.           r.r,g.g,b.b.
  152.  
  153.           char* ppm_colorname( pixel* colorP, pixval maxval, int hexok )
  154.  
  155.           Returns a pointer to a string describing the given color.
  156.           If the X11 color names file is available and the color
  157.           appears in it, that name is returned.  Otherwise, if the
  158.           hexok flag is true then a hexadecimal colorspec is returned;
  159.           if hexok is false and the X11 color names file is available,
  160.           then the closest matching color is returned; otherwise, it's
  161.           an error.
  162.  
  163.      SSSSEEEEEEEE AAAALLLLSSSSOOOO
  164.           pbm(3), pgm(3)
  165.  
  166.      AAAAUUUUTTTTHHHHOOOORRRR
  167.           Copyright (C) 1989, 1991 by Tony Hansen and Jef Poskanzer.
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.      Page 3                                           (printed 9/7/93)
  196.  
  197.  
  198.  
  199.